package com.thrd.basicframework.media;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;

/**
 * @author: ${唐杰}
 * @date: 2021/4/9
 */
public class MusicServiceConnection implements ServiceConnection {

    public MusicServiceConnection(OnMusicServiceConnection onMusicServiceConnection){
        this.onMusicServiceConnection=onMusicServiceConnection;
    }

    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        if(onMusicServiceConnection!=null){
            onMusicServiceConnection.onMusicServiceConnection(service);
        }
    }
    //Android系统在同service的连接意外丢失时调用这个．比如当service崩溃了或被强杀了．当客户端解除绑定时，这个方法不会被调用．
    @Override
    public void onServiceDisconnected(ComponentName name) {

    }

    @Override
    public void onBindingDied(ComponentName name) {

    }

    @Override
    public void onNullBinding(ComponentName name) {

    }

    private OnMusicServiceConnection onMusicServiceConnection;



    public interface OnMusicServiceConnection{
        void onMusicServiceConnection(IBinder service);
    }
}
